package com.yingside.collection;

import java.util.Set;
import java.util.TreeSet;

public class TestTreeSet {
    public static void main(String[] args) {
        String str;
        /*Set<String> sets = new TreeSet<>();
        sets.add("aaa");
        sets.add("ccc");
        sets.add("bbb");
        sets.add("kkk");
        sets.add("eee");

        //已经按照字母顺序排好序
        for (String s:sets) {
            System.out.println("s = " + s);
        }*/

        Set<Student> sets = new TreeSet<>();
        Student s1 = new Student(1,"张三1","2423535431");
        Student s2 = new Student(2,"张三2","2423535432");
        Student s3 = new Student(3,"张三3","2423535433");
        Student s4 = new Student(4,"张三4","2423535434");
        sets.add(s1);
        sets.add(s2);
        sets.add(s3);
        sets.add(s4);

        for (Student s:sets) {
            System.out.println("s = " + s);
        }













    }
}
